<?php
############## DIT STUK CODE ZORGT ERVOOR DAT JE ALS ADMIN INGELOGD MOET ZIJN OM DE PAGINA TE KUNNEN ZIEN ##############
    //Start de sessie
    session_start();

    //Load de benodigde bestanden
    require_once("includes/auth.php");
########################################################################################################################
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Nieuwsbrief versturen</title>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <link type="text/css" href="../css/pagination.css" rel="stylesheet" />
  <link rel="stylesheet" href="../css/reset.css" type="text/css" />
  <link rel="stylesheet" href="../css/960.css" type="text/css" />
  <link rel="stylesheet" href="../css/text.css" type="text/css" />
  <link type="text/css" href="../css/tablesorter.css" rel="stylesheet" />
  <link type="text/css" href="../css/sunny/jquery-ui-1.8.custom.css" rel="stylesheet" />
  <link type="text/css" href="../css/jquery.autocomplete.css" rel="stylesheet" />
  <link type="text/css" href="../css/style.css" rel="stylesheet" />
  <link type="text/css" href="../css/accmenu.css" rel="stylesheet" />
<script type="text/javascript" src="../js/jquery-1.4.2.min.js">
</script>
<script type="text/javascript" src="../js/jquery-ui-1.8.custom.min.js">
</script>
<script type="text/javascript" src="../js/jquery.tablesorter.js">
</script>
<script type="text/javascript" src="../js/jquery.autocomplete.min.js">
</script>
<script type="text/javascript" src="../js/menu.js">
</script>

</head>

<body>
  <div class="container_12">
    <div id="header" class="grid_12">
      
    </div>

    <div class="clear"></div>

    <div class="grid_12 spacer"></div>

    <div class="clear"></div>

    <div id="menu" class="grid_2">

        <?php
        include_once 'temp/menu_filler.php';
        ?>

    </div>

    <div id="adminarea" class="grid_10">
        <div id="tableholder">

              <?php

              // Connects to your Database
              include 'includes/connect.php';

              // tinyMCE laden
              include 'includes/loadtinymce.php';

              if (!isset($_POST['submit'])) // if page is not submitted to itself echo the form
              {
              ?>
                  <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
                  Onderwerp: <input type="text" name="onderwerp" size =30/><br>
                  Bericht: <textarea name="bericht" class="tinymce" cols=20 rows=30>

<STYLE>
 .headerTop { background-color:#dab6d9; border-top:0px solid #000000; border-bottom:1px solid #FFFFFF; text-align:center; }
 .adminText { font-size:10px; color:#996600; line-height:200%; font-family:verdana; text-decoration:none; }
 .headerBar { background-color:#FFFFFF; border-top:0px solid #333333; border-bottom:10px solid #FFFFFF; }
 .title { font-size:20px; font-weight:bold; color:#CC6600; font-family:arial; line-height:110%; }
 .subTitle { font-size:11px; font-weight:normal; color:#666666; font-style:italic; font-family:arial; }
 .defaultText { font-size:12px; color:#000000; line-height:150%; font-family:trebuchet ms; }
 .footerRow { background-color:#FFFFCC; border-top:10px solid #FFFFFF; }
 .footerText { font-size:10px; color:#996600; line-height:100%; font-family:verdana; }
 a { color:#FF6600; color:#FF6600; color:#FF6600; }
</STYLE>



<table width="100%" cellpadding="10" cellspacing="0" class="backgroundTable" bgcolor='#dab6d9' >
<tr>
<td valign="top" align="center">


<table width="550" cellpadding="0" cellspacing="0">

<tr>
<td style="background-color:#FFCC66;border-top:0px solid #000000;border-bottom:1px solid #FFFFFF;text-align:center;" align="center"><span style="font-size:10px;color:#996600;line-height:200%;font-family:verdana;text-decoration:none;">Email niet correct weergegeven? <a href="*|ARCHIVE|*" style="font-size:10px;color:#996600;line-height:200%;font-family:verdana;text-decoration:none;">Bekijk het in je browser.</a></span></td>
</tr>

<tr>
<td style="background-color:#FFFFFF;border-top:0px solid #333333;border-bottom:10px solid #FFFFFF;"><center><a href=""><IMG id=editableImg1 SRC="http://shop.danielvandorp.nl/daan/img/design/banner.png" BORDER="0" title="FoodWebz"  alt="FoodWebz" align="center"></a></center></td>
</tr>


</table>


<table width="550" cellpadding="20" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td bgcolor="#FFFFFF" valign="top" style="font-size:12px;color:#000000;line-height:150%;font-family:trebuchet ms;">

<p>
<span style="font-size:20px;font-weight:bold;color:#CC6600;font-family:arial;line-height:110%;">FoodWebz opent haar deuren!</span><br>
<span style="font-size:11px;font-weight:normal;color:#666666;font-style:italic;font-family:arial;">We vieren dit met vele aanbiedingen</span><br>
Lorem ipsum dolor sit amet, <a href="#">consectetuer adipiscing elit</a>. Sed at erat. Phasellus condimentum. Nullam sed magna. Donec quis tellus in neque congue porttitor. Proin sit amet ligula id leo porta rutrum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In suscipit, pede a rutrum malesuada, lacus massa euismod neque, a hendrerit justo ante at eros. <a href="#">Clickitus heritus.</a>
</p>

<p>
<span style="font-size:20px;font-weight:bold;color:#CC6600;font-family:arial;line-height:110%;">Nu ook glutenvrije producten in ons assortiment</span><br>
<span style="font-size:11px;font-weight:normal;color:#666666;font-style:italic;font-family:arial;">Binnenkort ook lactosevrij</span><br>

Lorem ipsum dolor sit amet, <a href="#">consectetuer adipiscing elit</a>. Sed at erat. Phasellus condimentum. Nullam sed magna. Donec quis tellus in neque congue porttitor. Proin sit amet ligula id leo porta rutrum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In suscipit, pede a rutrum malesuada, lacus massa euismod neque, a hendrerit justo ante at eros. <a href="#">Clickitus heritus.</a>
</p>

<p>
<span style="font-size:20px;font-weight:bold;color:#CC6600;font-family:arial;line-height:110%;">Een gesprek met Daniel van Dorp</span><br>
<span style="font-size:11px;font-weight:normal;color:#666666;font-style:italic;font-family:arial;">Onze getalenteerde CTO</span><br>
Lorem ipsum dolor sit amet, <a href="#">consectetuer adipiscing elit</a>. Sed at erat. Phasellus condimentum. Nullam sed magna. Donec quis tellus in neque congue porttitor. Proin sit amet ligula id leo porta rutrum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. In suscipit, pede a rutrum malesuada, lacus massa euismod neque, a hendrerit justo ante at eros. <a href="#">Clickitus heritus.</a>

</p>






</td>
</tr>

<tr>
<td style="background-color:#FFFFCC;border-top:10px solid #FFFFFF;" valign="top">
<span style="font-size:10px;color:#996600;line-height:100%;font-family:verdana;">
FoodWebz Newsletter <br />
<br />
<a href="*|UNSUB|*">Unsubscribe</a> *|EMAIL|* from this list.<br />

<br />
Ons mail adres is:<br />
info@foodwebz.nl<br />
<br />
Ons telefoonnummer:<br />
+31 6 15582159<br />
<br />
Copyright (C) 2010 FoodWebz Alle wijzigingen voorbehouden.<br />
<br />
<a href="mail:">Forward</a> this email to a friend


</span>
</td>
</tr>

</table>












</td>
</tr>
</table>

                  </textarea><br>
                  <input type="submit" name="submit" value="submit" />
                  </form>
              <?php
              }
              else
              {
              $onderwerp = $_POST['onderwerp'];
              $bericht = $_POST['bericht'];


              //haal email adressen op
              $sql = "SELECT * FROM klant";
              $result = mysql_query($sql) or die(mysql_error());

              //maak een mailheader from:
              $headers  = 'MIME-Version: 1.0' . "\r\n";
              $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
              $headers .= 'From: FoodWebz Mailinglist<no-reply@danielvandorp.nl>' . "\r\n";

              	// itereer door de adresssen en stuur deze de nieuwsbrief
              	while($row = mysql_fetch_array($result)) {
              		set_time_limit(0);
              		$email = $row['email'];
              		// $klantvoornaam = $row['voornaam'];
              		// $tussenvoegsel = $row['tussenvoegsel'];
              		// $klantachternaam = $row['achternaam'];
              		// $klantgegevens = "Beste $klantvoornaam $tussenvoegsel $klantachternaam,";
                      $bericht = "<html>\n<body leftmargin=\"0\" marginwidth=\"0\" topmargin=\"0\" marginheight=\"0\" offset=\"0\">\n".$bericht."\n</body>\n</html>";

              		mail($email, stripslashes($onderwerp), stripslashes($bericht), stripslashes($headers));
              		print "Nieuwsbrief verstuurd naar: $email<br>";
              		}
              }

              ?>

          </div>
    </div>


    <div class="clear"></div>

    <div class="grid_12 spacer"></div>

    <div class="clear"></div>
</div>
</body>
</html>